package gui;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JPanel;

class BackgroundPanel extends JPanel {
	Image image;

	public BackgroundPanel(String backgroundType) {

		if (backgroundType.equals("abstract")) {
			try {
				image = javax.imageio.ImageIO.read(new java.net.URL(getClass()
						.getResource("AbstractPicture.jpg"),
						"AbstractPicture.jpg"));
			} catch (Exception e) { /* handled in paintComponent() */
			}
		}
		if (backgroundType.equals("abstract2")) {
			try {
				image = javax.imageio.ImageIO.read(new java.net.URL(getClass()
						.getResource("AbstractPicture2.jpg"),
						"AbstractPicture2.jpg"));
			} catch (Exception e) { /* handled in paintComponent() */
			}
		}
	}

	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		if (image != null)
			g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), this);
	}
}
